<template>
    <form>
        <slot></slot>
    </form>
</template>
<script>
export default {
    name:'elForm',
    props:{ //接收传递进来
        model:{
            type:Object,
            default:()=>{}
        },
        rules:Object
    },
    provide(){ //注入，方便子孙组件拿到数据
        return {elForm:this}
    },
    methods: {
         validate(cb){
            let r = this.$broadcast('elFormItem').every(item=>item.validate());
            cb(r)
        }
    },

}
</script>